class Cache {
    //设置缓存
    set({key, data, expire}) {
        wx.setStorageSync(key, {data,expire})
    }
    //获取缓存
    get({key}) {
        let nt = new Date().getTime()
        let ret = wx.getStorageSync(key)
        if(ret.expire == 0) {
            return ret.data
        }else{
            if(nt <= ret.expire) {
                return ret.expire
            }else{
                wx.removeStorageSync(key)
                return null;
            }
        }
    }
}

export default Cache